export const axios = {
  get<T>(url: string): Promise<T> {
    const { promise, resolve } = (Promise as any).withResolvers()

    const xhr = new XMLHttpRequest()
    xhr.open('GET', url)

    xhr.onreadystatechange = () => {
      if (xhr.readyState == 4 && xhr.status == 200) {
        setTimeout(() => {
          resolve(JSON.parse(xhr.responseText))
        }, 2000)
      }
    }

    xhr.send(null)

    return promise
  }
}